<!DOCTYPE html>
<html lang="en">
<head>
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0,viewport-fit=cover">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta content="telephone=no" name="format-detection"/>
    <meta charset="UTF-8">
    <title>爱电影,爱生活(ady01.com),电影资源库.</title>
    <!-- head 中 -->
    <link rel="stylesheet" href="https://cdn.bootcss.com/weui/1.1.2/style/weui.min.css">
    <link rel="stylesheet" href="https://cdn.bootcss.com/jquery-weui/1.2.0/css/jquery-weui.min.css">
    <!-- body 最后 -->
    <script src="https://cdn.bootcss.com/jquery/1.11.0/jquery.min.js"></script>
    <script src="https://cdn.bootcss.com/jquery-weui/1.2.0/js/jquery-weui.min.js"></script>
    <!-- 如果使用了某些拓展插件还需要额外的JS -->
    <script src="https://cdn.bootcss.com/jquery-weui/1.2.0/js/swiper.min.js"></script>
    <script src="https://cdn.bootcss.com/jquery-weui/1.2.0/js/city-picker.min.js"></script>
    <script src="film/index.js"></script>
    <style type="text/css">
        html, body {
            margin: 0px;
            margin: 0px;
        }

        body {
            font: 14px/1.5 tahoma, arial, "\5b8b\4f53";
            background-color: beige;
        }
        #list {
            padding: 10px;
        }

        .film-item {
            word-break: break-all; /* 支持IE和chrome，FF不支持*/
            word-wrap: break-word; /* 以上三个浏览器均支持 */
            margin: 10px 0px;
            margin-bottom: 10px;
            list-style: disc;
            margin-left: 25px;
        }

        .film-item .film-ext li {
            color: #666;
            font-style: italic;
            font-size: 12px;
            font-weight: normal;
        }

        .film-item .film-title {
            font-size: 12px;
            font-weight: bold
        }

        #searchResult{
            max-height:300px;
            overflow: scroll;
        }
        .search-result-item{
            background-color: #EC8B89;
            color: white;
        }
        .search-result-item-a{
            color: white;
        }
        .search-result-item-a:hover{
            color: blue;
        }
    </style>
</head>
<body ontouchstart>
<div id="head-tip"
     style="position: fixed; top: 0px;left: 0px; width: 100%; color: #FFF; font-weight: bold; text-align: center; line-height: 30px; font-size:16px; background-color: #710909">
    观影提示：浏览器打开当前网站->下载迅雷客户端(手机或者PC)->点击相关电影标题
</div>
<div id="search-div" style="position: fixed; top: 0px;left: 0px; width: 100%; color: #FFF; background-color: #710909">
    <div class="page__bd">
        <!--<a href="javascript:;" class="weui-btn weui-btn_primary">点击展现searchBar</a>-->
        <div class="weui-search-bar" id="searchBar">
            <div class="weui-search-bar__form">
                <div class="weui-search-bar__box">
                    <i class="weui-icon-search"></i>
                    <input type="search" class="weui-search-bar__input" id="searchInput" placeholder="输入想看的电影" required/>
                    <a href="javascript:" class="weui-icon-clear" id="searchClear"></a>
                </div>
                <label class="weui-search-bar__label" id="searchText">
                    <i class="weui-icon-search"></i>
                    <span>输入想看的电影</span>
                </label>
            </div>
            <a href="javascript:" class="weui-search-bar__cancel-btn" id="searchCancel">取消</a>
        </div>
        <div class="<!--weui-cells -->searchbar-result" id="searchResult">

        </div>
    </div>
    <script type="text/javascript">
        function searchFilm(txt) {
            var list = [];
            var size = 0;
            var flagExit = false;
            var length = filmIndexMap.length;
            for (var i = 0; i < length; i++) {
                var film = filmIndexMap[i];
                for (var id in film) {
                    var title = film[id];
                    if (title.indexOf(txt) != -1) {
                        list.push({"id": id, "title": title});
                        size++;
                        if (size == 20) {
                            flagExit = true;
                        }
                    }
                }
                if(flagExit){
                    break;
                }
            }
            return list;
        }

        $(function(){
            var $searchBar = $('#searchBar'),
                $searchResult = $('#searchResult'),
                $searchText = $('#searchText'),
                $searchInput = $('#searchInput'),
                $searchClear = $('#searchClear'),
                $searchCancel = $('#searchCancel');

            function hideSearchResult(){
                $searchResult.hide();
                $searchInput.val('');
            }
            function cancelSearch(){
                hideSearchResult();
                $searchBar.removeClass('weui-search-bar_focusing');
                $searchText.show();
            }

            $searchText.on('click', function(){
                $searchBar.addClass('weui-search-bar_focusing');
                $searchInput.focus();
            });
            $searchInput
                .on('blur', function () {
                    if(!this.value.length) cancelSearch();
                })
                .on('input', function(){
                    console.log(this.value);
                    if (this.value.length) {
                        var filmList = searchFilm(this.value)
                        $searchResult.html("");
                        $searchResult.show();
                        if (filmList.length > 0) {
                            var html = "";
                            for (var i = 0; i < filmList.length; i++) {
                                var film = filmList[i];
                                var href = "filmdetail.html?id=" + film.id;
                                var s = "<div class=\"search-result-item weui-cell weui-cell_access\">" +
                                    "                <div class=\"weui-cell__bd weui-cell_primary\">" +
                                    "                    <a class='search-result-item-a' style='display: block' target='filmdetail' href='" + href + "'>" + film.title + "</a>" +
                                    "                </div>" +
                                    "            </div>";
                                html += s;
                            }
                            $searchResult.html(html);
                        }
                    } else {
                        $searchResult.hide();
                    }
                })
            ;
            $searchClear.on('click', function(){
                hideSearchResult();
                $searchInput.focus();
            });
            $searchCancel.on('click', function(){
                cancelSearch();
                $searchInput.blur();
            });
        });

    </script>
</div>
<ol id="list" class=\"film-item\">

    <!--<div class="film-item">
        <div class="film-title"><a target="_blank" href="Thunder://QUFmdHA6Ly95Z2R5ODp5Z2R5OEB5ZzQ1LmR5ZHl0dC5uZXQ6NDA3NS/pmLPlhYnnlLXlvbF3d3cueWdkeTguY29tLuaXoOmXruilv+S4nC5IRC4xMDgwcC7lm73or63kuK3lrZcubXA0Wlo=">铁娘子DVD中英双字</a></div>
        <ul class="film-ext" style="margin-left:20px; list-style: none">
            <li>迅雷链接:<a target="_blank" href="Thunder://QUFmdHA6Ly95Z2R5ODp5Z2R5OEB5ZzQ1LmR5ZHl0dC5uZXQ6NDA3NS/pmLPlhYnnlLXlvbF3d3cueWdkeTguY29tLuaXoOmXruilv+S4nC5IRC4xMDgwcC7lm73or63kuK3lrZcubXA0Wlo=">Thunder://QUFmdHA6Ly95Z2R5ODp5Z2R5OEB5ZzQ1LmR5ZHl0dC5uZXQ6NDA3NS/pmLPlhYnnlLXlvbF3d3cueWdkeTguY29tLuaXoOmXruilv+S4nC5IRC4xMDgwcC7lm73or63kuK3lrZcubXA0Wlo=</a></li>
            <li>快车链接:<a target="_blank" href="Flashget://W0ZMQVNIR0VUXWZ0cDovL3lnZHk4OnlnZHk4QHlnNDUuZHlkeXR0Lm5ldDo0MDc1L+mYs+WFieeUteW9sXd3dy55Z2R5OC5jb20u5peg6Zeu6KW/5LicLkhELjEwODBwLuWbveivreS4reWtly5tcDRbRkxBU0hHRVRd&something">Flashget://W0ZMQVNIR0VUXWZ0cDovL3lnZHk4OnlnZHk4QHlnNDUuZHlkeXR0Lm5ldDo0MDc1L+mYs+WFieeUteW9sXd3dy55Z2R5OC5jb20u5peg6Zeu6KW/5LicLkhELjEwODBwLuWbveivreS4reWtly5tcDRbRkxBU0hHRVRd&something</a></li>
            <li>qq旋风:<a target="_blank" href="qqdl://ZnRwOi8veWdkeTg6eWdkeThAeWc0NS5keWR5dHQubmV0OjQwNzUv6Ziz5YWJ55S15b2xd3d3LnlnZHk4LmNvbS7ml6Dpl67opb/kuJwuSEQuMTA4MHAu5Zu96K+t5Lit5a2XLm1wNA==">qqdl://ZnRwOi8veWdkeTg6eWdkeThAeWc0NS5keWR5dHQubmV0OjQwNzUv6Ziz5YWJ55S15b2xd3d3LnlnZHk4LmNvbS7ml6Dpl67opb/kuJwuSEQuMTA4MHAu5Zu96K+t5Lit5a2XLm1wNA==</a></li>
        </ul>
    </div>-->
</ol>
<div id="weui-loadmore" class="weui-loadmore">
    <i class="weui-loading"></i>
    <span class="weui-loadmore__tips">正在加载</span>
</div>
<div style="line-height: 50px; text-align: center">
    备案号：
    <a target="_blank" href="http://www.miitbeian.gov.cn">沪ICP备12033211号</a>
</div>
</body>
<script>
    $(function () {
        $("#search-div").css({"margin-top": $("#head-tip").height()});
        $("#list").css({"margin-top": $("#head-tip").height() + $("#search-div").height()});
    });
    var page = 175;
    var curPage = 1;
    var loading = false;

    function getFilmItemHtml(filmModel) {
        var title = filmModel.title;
        var thunder = filmModel.extMap.thunder;
        var flashget = filmModel.extMap.flashget;
        var qqdl = filmModel.extMap.qqdl;
        var href = "filmdetail.html?id=" + filmModel.id;
        var s =
            "<li class='film-item'>" +
            "        <div class=\"film-title\"><a target=\"_blank\" href=\"" + href + "\">" + title + "</a></div>" +
            "        <ul class=\"film-ext\" style=\"margin-left:20px; list-style: none\">" +
            /*"            <li>迅雷链接:<a target=\"_blank\" href=\"" + thunder + "\">" + thunder + "</a></li>" +
             "            <li>快车链接:<a target=\"_blank\" href=\"" + flashget + "\">" + flashget + "</a></li>" +
             "            <li>qq旋风:<a target=\"_blank\" href=\"" + qqdl + "\">" + qqdl + "</a></li>" +*/
            "        </ul>" +
            "</li>";
        return s;
    }

    function loadPage() {
        if (curPage >= page) {
            return;
        }
        $.ajax({
            url: "film/new/dytt_" + curPage + ".json", success: function (data) {
                for (var a in data) {
                    var filmModel = data[a];
                    $("#list").append(getFilmItemHtml(filmModel));
                }
                loading = false;
                $("#weui-loadmore").hide();
            }
        });
        curPage++;
    }
    loadPage(curPage);
    loadPage(curPage);


    $(document.body).infinite(200).on("infinite", function () {
        if (curPage >= page) {
            return;
        }
        $("#weui-loadmore").show();
        if (loading) return;
        loading = true;
        loadPage(curPage);
    });
</script>
<script>
    var _hmt = _hmt || [];
    (function() {
        var hm = document.createElement("script");
        hm.src = "https://hm.baidu.com/hm.js?886377726f604e4e3e3a4ef099c24100";
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(hm, s);
    })();
</script>
</html>